package cn.net.xyan.easy.spring.jpa.test.dto;

import cn.net.xyan.easy.spring.jpa.annotation.QueryCondition;
import cn.net.xyan.easy.spring.jpa.annotation.QueryRequest;
import cn.net.xyan.easy.spring.jpa.test.entity.*;
import cn.net.xyan.easy.spring.jpa.utils.JPA;

import javax.persistence.criteria.JoinType;
import java.util.LinkedList;
import java.util.List;

/**
 * Created by zarra on 16/1/22.
 */
@QueryRequest(entityType = EntityAAA.class,distinct = true)
public class QueryAAA {

    public String value;

    Long longValue;

    String stringValue;

    List<String> values = new LinkedList<>();

    public QueryAAA(){

    }
    //"entityAA.entityB.aList.value";
    @QueryCondition(value =
            EntityAAA_.entityAA_+"."
            + EntityAA_.entityB_+"."
            + EntityB_.aList_+"."
            + EntityA_.value_, joinType = JoinType.LEFT)
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @QueryCondition(value = EntityAAA_.longValue_,hasIgnoreValue = true,ignoreValue = "1")
    public Long getLongValue() {
        return longValue;
    }

    public void setLongValue(Long longValue) {
        this.longValue = longValue;
    }

    public String getStringValue() {
        return stringValue;
    }

    public void setStringValue(String stringValue) {
        this.stringValue = stringValue;
    }

    @QueryCondition(values ={EntityAAA_.entityAA_,EntityAA_.entityB_,EntityB_.aList_,EntityA_.value_})
    public List<String> getValues() {
        return values;
    }

    public void setValues(List<String> values) {
        this.values = values;
    }
}
